<template>
  <Panel class="row-around" second :mainStyle="{ flexDirection: 'row' }">
    <!-- 事件 -->
    <div class="around-box">
      <div class="text">附近范围的事件</div>
      <div class="content">
        <div class="event">
          <span class="event-text">施工</span>
          <span class="sg">
            <span class="sg-value absolute number">{{ roundEvent.accident }}</span>
          </span>
        </div>
        <div class="event">
          <span class="event-text">事故</span>
          <span class="sj">
            <span class="sj-value absolute number">{{ roundEvent.construction }}</span>
          </span>
        </div>
      </div>
    </div>

    <!-- 客车 -->
    <div class="around-box">
      <div class="text">范围内两客一危车辆</div>
      <div class="content">
        <div class="car">
          <div class="car-img kc"></div>
          <div class="car-right">
            <div class="car-text">客车</div>
            <div class="car-value number">{{ roundGuest.kc || 0 }}</div>
          </div>
        </div>
        <div class="car">
          <div class="car-img hc"></div>
          <div class="car-right">
            <div class="car-text">危化车</div>
            <div class="car-value number">{{ roundGuest.whc || 0 }}</div>
          </div>
        </div>
      </div>
    </div>
  </Panel>
</template>

<script>
export default {
  name: 'Round'
}
</script>

<script setup>
/**
 * @desc 附件事件与客一危
 * @author 邓清波
 * @date  22/11/4
 * ***/
import Panel from '../../components/panel'
import { defineProps, toRefs } from 'vue'
const props = defineProps({
  // 两课一危
  roundGuest: {
    type: Object,
    required: true,
    default: () => ({
      kc: 0, // 客车
      whc: 0 // 危化车
    })
  },

  // 事件
  roundEvent: {
    type: Object,
    required: true,
    default: () => ({
      accident: 0, // 施工
      construction: 0 // 事故
    })
  }
})

const { roundGuest, roundEvent } = toRefs(props)
</script>
<style lang="less" scoped>
@import url(../../styles/themes/variables.less);

.row-around {
  width: 274px;
  display: flex;

  .around-box {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    border: 1px solid #74acf2;

    .text {
      font-size: 10px;
      width: 100%;
      margin-top: 10px;
      text-align: center;
      letter-spacing: -0.5px;
      white-space: nowrap;
    }
    .content {
      flex: 1;
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
    }

    .event {
      margin: 0px 15px;
      display: flex;
    }

    .event-text {
      padding-top: 28px;
      margin-right: 8px;
      font-size: 11px;
      white-space: nowrap;
    }

    .sj {
      position: relative;
      width: 46px;
      height: 54px;
      background: url('../../assets/images/traffic/trafficSectionDetail-around-sg.png') no-repeat;
      background-size: 100%;
    }

    .sg {
      position: relative;
      width: 46px;
      height: 54px;
      background: url('../../assets/images/traffic/trafficSectionDetail-around-sj.png') no-repeat;
      background-size: 100%;
    }

    .sj-value {
      color: #ec421a;
    }

    .sg-value {
      color: #06a7d1;
    }

    .absolute {
      font-size: 24px;
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      top: 20%;
    }

    .car {
      display: flex;
      justify-content: center;
      margin-top: 14px;
      text-align: center;

      .car-img {
        width: 30px;
        height: 40px;
      }

      .car-right {
        width: 50px;
      }

      .car-text {
        font-size: 12px;
        white-space: nowrap;
      }

      .car-value {
        font-size: 18px;
        line-height: 22px;
        color: @primary-color;
      }

      .hc {
        background: url('../../assets/images/traffic/trafficSectionDetail-around-hc.png') no-repeat;
        background-size: 100%;
      }

      .kc {
        background: url('../../assets/images/traffic/trafficSectionDetail-around-kc.png') no-repeat 100%;
        background-size: 100%;
      }
    }
  }

  .around-box:nth-child(2) {
    display: flex;
    width: 126px !important;
    align-items: center;
    margin-left: 5px;
  }
}
</style>
